(function(){

    /**
     * 接口用法：使用关键字interface
     * 接口特点：接口里面的属性和方法都是抽象属性和方法
     * 接口作用：可以对类进行规范。一个类可以实现对各接口，接口可以被覆盖
     */

    interface myInterface1 {
        name: string;
        sayHellow():void;
    }
    interface myInterface2 {
        age:number;
    }
    // 重复定义接口myInterface2
    interface myInterface2 {
        color:string
    }

    class Animal implements myInterface1,myInterface2{
        name: string;
        age: number;
        color: string;
        constructor(name:string,age:number,color:string) {
            this.name = name
            this.age = age
            this.color = color
        }
       
        sayHellow(): void {
            console.log(`名字：${this.name}；年龄：${this.age}岁；颜色：${this.color}`)
        }

    }

    const animal = new Animal("狗子",2,"黄色")
    animal.sayHellow()


    abstract class Dog1 {
        name = "大黄"
        abstract age:number;
        abstract sayHello():void;
    }

    class MyDog extends Dog1{
        age: number;
        constructor(age:number) {
            super()
            this.age = age
        }
        sayHello(): void {
            console.log(`姓名：${this.name}；年龄：${this.age}`)
        }
       
    }
})()